UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+1WM0uhQKzgK0pCSnsNdT93FruBCbf0SnkpPFNF1cQA='
WHERE
key_id = '00365bc2e2a84832403a3ae6c6ad1349769967880d89256b5240047fee09f6ce'
AND (
token = '+1WM0uhQKzgK0pCSnsNdT93FruBCbf0SnkpPFNF1cQA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)