UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wLoHlY9EkeNafEfT4ZH1BqM3ViopqY9iltvVAwRuUco=' 
WHERE 
  key_id = '8f874bfe84e8c23fb27622a06f4938f9d5ea74c87e7c467a7a8d4ef52eb69f97' 
  AND (
    token = 'wLoHlY9EkeNafEfT4ZH1BqM3ViopqY9iltvVAwRuUco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045