UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TgXBxtFJN1GAdKfLGlelGmT7Sw56HmyZrAPiVHCmpQE='
WHERE
key_id = '5162207db504595cfa00b2068e1321065ad5bd72df07b26558f2d2ad97840048'
AND (
token = 'TgXBxtFJN1GAdKfLGlelGmT7Sw56HmyZrAPiVHCmpQE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)