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