UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4reBCAVhNgc7aSrn30Sb6K80DS9OxWrN9zC3FANUG4M='
WHERE
key_id = 'e72514c63ac3b75ed0013ee1aecdb6e71fa24927f948d8894e76fbc06203bfd0'
AND (
token = '4reBCAVhNgc7aSrn30Sb6K80DS9OxWrN9zC3FANUG4M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)