UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KaMMJbBSV+U0XCNdyG+HaJX1UAAYrPaEcaq0qIoY4ps='
WHERE
key_id = 'a34ff2c43fe805555cd620a208717273efa9bac60a886b5e6dd715a97e638bd9'
AND (
token = 'KaMMJbBSV+U0XCNdyG+HaJX1UAAYrPaEcaq0qIoY4ps='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)