UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7O5rshEA2GzdgwZQiIF9Y8y5KYXizWYuaI8mB4GK77Q='
WHERE
key_id = 'ba0e7e5130788b483354b4779ab418a6b8ec3a801c7ef991a59a1005a72a36a3'
AND (
token = '7O5rshEA2GzdgwZQiIF9Y8y5KYXizWYuaI8mB4GK77Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)