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