UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RE7fXI6diOpeI2Y1zjRTuYf0CT7M2m7DRcJQHkE0Ypw='
WHERE
key_id = '8b69cdd9ae5851f40c83e19eb8e8248e7a6978c9c9f5a1ab8a41f9271443ec21'
AND (
token = 'RE7fXI6diOpeI2Y1zjRTuYf0CT7M2m7DRcJQHkE0Ypw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)