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