UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nIOZYmR1TC5bv8GL4WfcIrAoL3N5DJvcJaMjNUETzDk='
WHERE
key_id = '0afe9f26fe63bea1a4a146b08324396c412fa2d167fa7084e52fb6c44f88fbd0'
AND (
token = 'nIOZYmR1TC5bv8GL4WfcIrAoL3N5DJvcJaMjNUETzDk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)