UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rYPw42dZYr58yf//9IJDtrs5R5jwLQS51LUSlfUKI8k='
WHERE
key_id = '861091a8f79e17eb8e7e1103325d4b258593f49273030f478d0181f57577e5d5'
AND (
token = 'rYPw42dZYr58yf//9IJDtrs5R5jwLQS51LUSlfUKI8k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)