UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MjwPtpG4Zcvil/paF4wkAuBMYKNAOgEUIpJLjsz4JRo='
WHERE
key_id = '59c5355e16b3b4155ce0bd89802e430b100b7203fc83a134a49372462108f26c'
AND (
token = 'MjwPtpG4Zcvil/paF4wkAuBMYKNAOgEUIpJLjsz4JRo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)