UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZ02AVPFNZnvzBbDy5qKIvBKlFukpfMB++B+de71/ZU='
WHERE
key_id = '2ea82bedaf0937aa38eaf04a95e165204424627d2ebd1ee8f1f211065a57ad8a'
AND (
token = 'qZ02AVPFNZnvzBbDy5qKIvBKlFukpfMB++B+de71/ZU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)