UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWd3Yr7NTcEscCDZN40MMLZ7YeVg2hOOx/ULRcc+M04='
WHERE
key_id = '22506e3dbdf81787d035d773ec6ec1fbdab6095aead0d7fa5020ee2e4f8f2d48'
AND (
token = 'KWd3Yr7NTcEscCDZN40MMLZ7YeVg2hOOx/ULRcc+M04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)