UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pQPWjiqqACBPbqUAXAKIoW0HNtuDTteTZaivHsKSFZA='
WHERE
key_id = '888b521ba384524d0b0c267f20cdfbe786606d642fe738edbb89e476d867d0c9'
AND (
token = 'pQPWjiqqACBPbqUAXAKIoW0HNtuDTteTZaivHsKSFZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)