UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SXIf7NK1HOSTEHmosLhJcQKtpsxPKX1sNEklq1HcsVE='
WHERE
key_id = '2dcd4b2d4237a7cd0159b3182b48b4b2def2a0676195085474468e1ebf62f5d3'
AND (
token = 'SXIf7NK1HOSTEHmosLhJcQKtpsxPKX1sNEklq1HcsVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)