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

Query time 0.00039