UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PBbkEUGKokIs63GPtlUet4Fc0WO/oYFrjdSikFEZuMk='
WHERE
key_id = 'fd82d61ef895687b4b66e2cf06601b757ae4545a0bbd582e4673e16efdb33ad2'
AND (
token = 'PBbkEUGKokIs63GPtlUet4Fc0WO/oYFrjdSikFEZuMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)