UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wr4+Dks1g4Hvn5TCLi3056smqSLO9LUOY6FlAK1ItNg='
WHERE
key_id = '1ea3aae95802aec084052941a8d3f60898a523c3c84b9e544778406901ffa08d'
AND (
token = 'wr4+Dks1g4Hvn5TCLi3056smqSLO9LUOY6FlAK1ItNg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)