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