UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2ksaPyVJ8iR6NwgRFy3TbzYtdTyD58REXoPJwcgtNNg='
WHERE
key_id = '9d972209fa7fa7c61ecad563db7e09caa0128cdc98cdf87fd5968ffaa2b35dc5'
AND (
token = '2ksaPyVJ8iR6NwgRFy3TbzYtdTyD58REXoPJwcgtNNg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)