UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ye2jsnrzwXrodfAg3M7DOWC40JE9YyDxxzyNsaGHttQ='
WHERE
key_id = '388a05b1659348110752d1db6e13a743cfa995574a2e6edd97257ba3a1d1299f'
AND (
token = 'Ye2jsnrzwXrodfAg3M7DOWC40JE9YyDxxzyNsaGHttQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)