UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V65/IzslTsjEiRRXswfSbqaYd5EgLiasu2Y/jf8H7i8='
WHERE
key_id = 'cac5fafedf408c36adfbf52d6ab7cb5e6cfdbc2a5df8a8993e90ef043de21d64'
AND (
token = 'V65/IzslTsjEiRRXswfSbqaYd5EgLiasu2Y/jf8H7i8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)