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