UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/vVXbT4Ao1S3FO6ILQWyPXDE5FfUOrHSYB83thgDzPU='
WHERE
key_id = 'c4add100f4bb1526f137ed3b61dce5fc84b0b0f3bc33a123687a4a1dfb3b55e5'
AND (
token = '/vVXbT4Ao1S3FO6ILQWyPXDE5FfUOrHSYB83thgDzPU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)