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