UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YFrr152Zf6GMQupc7XvWhAjWUQdfAAXXI1hRSKVbkoc='
WHERE
key_id = 'a80c9c6383ff58be11a96fa5bbac62b6c142caa49052143b8c0aecfbf03d1f4f'
AND (
token = 'YFrr152Zf6GMQupc7XvWhAjWUQdfAAXXI1hRSKVbkoc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)