UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KlzQkk3+Wa4hAciFw+Sm69znJxRoVvAyHebCtLBvkj0='
WHERE
key_id = 'a52ef8700b2b3022ed32137fcaac23213ed4b3d0b970e802b9dcf5fb41d30ffd'
AND (
token = 'KlzQkk3+Wa4hAciFw+Sm69znJxRoVvAyHebCtLBvkj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)