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